package lumis.service.portalmanagement.sendmail;

import java.util.Collections;
import java.util.List;

import lumis.doui.source.AbstractObjectDataProvider;
import lumis.doui.source.TabularSource;
import lumis.portal.PortalException;
import lumis.portal.authentication.SessionConfig;
import lumis.portal.manager.ManagerFactory;
import lumis.portal.sendmail.IMailConfig;
import lumis.util.ITransaction;

/**
 * Provides sendmail configuration data.
 * 
 * @version $Revision: 6251 $ $Date: 2007-03-27 10:49:29 -0300 (Tue, 27 Mar 2007) $
 * @since 4.0.4
 */
public class MailConfigDataProvider extends AbstractObjectDataProvider<TabularSource, IMailConfig>
{
	public MailConfigDataProvider()
	{
		super(IMailConfig.class);
	}

	@Override
	protected List<IMailConfig> loadObjects(SessionConfig sessionConfig, TabularSource source, ITransaction transaction) throws PortalException
	{
		IMailConfig mailConfig = ManagerFactory.getSendMailManager().getMailConfig(sessionConfig, transaction);
		return Collections.singletonList(mailConfig);
	}
}
